#include <algorithm>
#include <cstring>
#include <iostream>
using namespace std;
using ll = long long;
using T = int;
T rad(); // quick read
const int inf = 0x3f3f3f3f;
#define rf(i, n) for (int i = 1; i <= (n); ++i)
const int max_size = 5 + 100;
const int maxn = 5 + 5e5;

int n;
int a[maxn];

int up;
bool visit[maxn];
bool dfs(int num, int l, int r) {
    // printf("%d %d\n", l, r);
    if (l == 0 && r == n + 1) return 1;
    if (num >= up) return 1;
    if (l > 0 && num >= a[l])
        return dfs(num * 2, l - 1, r);
    else if (r <= n && num >= a[r])
        return dfs(num * 2, l, r + 1);
    return 0;
}

int main() {
    n = rad();
    up = 0;
    rf(i, n) a[i] = rad(), up = max(up, a[i]);
    int ans = 0;
    rf(i, n) visit[i] = dfs(a[i], i - 1, i + 1), ans += visit[i];
    printf("%d\n", ans);
    rf(i, n) if (visit[i]) printf("%d ", i);
}

T rad() {
    T back = 0;
    int ch = 0, posi = 0;
    for (; ch < '0' || ch > '9'; ch = getchar())
        posi = ch ^ '-';
    for (; ch >= '0' && ch <= '9'; ch = getchar())
        back = (back << 1) + (back << 3) + (ch & 0xf);
    return posi ? back : -back;
}